package com.tobie.info.controller;

import com.tobie.info.entity.SpotEntity;
import com.tobie.info.service.ISpotService;
import com.tobie.info.util.ResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author lc
 * @Date 2023/11/20 15:17
 * @注释 景点页面控制器
 */
@Slf4j
@RestController
@RequestMapping("/spot")
public class SpotController {

    @Resource
    private ISpotService spotService;

    @GetMapping("/getAllSpot")
    public ResultVo<List<SpotEntity>> getAllSpot(){
        return ResultVo.success(spotService.getAllSpot());
    }

    @GetMapping("/getSpot/{positionName}")
    public ResultVo<List<SpotEntity>> getSpotByPositionName(@PathVariable("positionName") String positionName){
        return ResultVo.success(spotService.getSpotByPositionName(positionName));
    }
}
